package cn.edu.scau.cmi.zengGuanSheng.abstractFactoryPattern;

import javafx.fxml.FXML;

import javafx.scene.control.Button;
import cn.edu.scau.cmi.zengGuanSheng.comprehensiveExperiment.MainClient;
import javafx.event.ActionEvent;

import javafx.scene.control.MenuItem;

import javafx.scene.control.TextArea;

import javafx.scene.image.ImageView;

import javafx.scene.control.MenuButton;

public class MyController {
	@FXML
	private TextArea textArea;
	@FXML
	private Button btn;
	@FXML
	private MenuButton MenuBtn1;
	@FXML
	private MenuItem menu1;
	@FXML
	private MenuItem menu2;
	@FXML
	private MenuItem menu3;
	@FXML
	private MenuItem menu4;
	@FXML
	private ImageView imageView;
	@FXML
	private MenuButton MenuBtn2;
	@FXML
	private MenuItem menu5;
	@FXML
	private MenuItem menu6;
	@FXML
	private MenuItem menu7;
	@FXML
	private MenuItem menu8;
	
	@FXML
	private Button btn_return;//comprehensiveExperiment用到
	
	private static Insurance insurance= null;

	// Event Listener on Button[#btn].onAction
	@FXML
	public void eventButton(ActionEvent event) {
		// TODO Autogenerated
		textArea.clear();
		if(null==insurance)
			textArea.setText("请先选择保险类型");
		else 
			textArea.setText(insurance.claim());
	}
	// Event Listener on MenuItem[#menu1].onAction
	@FXML
	public void eventMenuItem1(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PICCFactory().getBodyInjury();
		MenuBtn1.setText("司机受伤");
	}
	// Event Listener on MenuItem[#menu2].onAction
	@FXML
	public void eventMenuItem2(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PICCFactory().getCarDamage();
		MenuBtn1.setText("汽车损坏");
	}
	// Event Listener on MenuItem[#menu3].onAction
	@FXML
	public void eventMenuItem3(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PICCFactory().getCasualty();
		MenuBtn1.setText("人员伤亡");
	}
	// Event Listener on MenuItem[#menu4].onAction
	@FXML
	public void eventMenuItem4(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PICCFactory().getMultipleAccidents();
		MenuBtn1.setText("多种事故");
	}
	// Event Listener on MenuItem[#menu5].onAction
	@FXML
	public void eventMenuItem5(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PingAnFactory().getBodyInjury();
		MenuBtn2.setText("司机受伤");
	}
	// Event Listener on MenuItem[#menu6].onAction
	@FXML
	public void eventMenuItem6(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PingAnFactory().getCarDamage();
		MenuBtn2.setText("汽车损坏");
	}
	// Event Listener on MenuItem[#menu7].onAction
	@FXML
	public void eventMenuItem7(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PingAnFactory().getCasualty();
		MenuBtn2.setText("人员伤亡");
	}
	// Event Listener on MenuItem[#menu8].onAction
	@FXML
	public void eventMenuItem8(ActionEvent event) {
		// TODO Autogenerated
		insurance = new PingAnFactory().getMultipleAccidents();
		MenuBtn2.setText("多种事故");
	}
	
	//综合性实验需要调用的事件处理
	@FXML
	public void eventReturn(ActionEvent event) {
		MainClient main = new MainClient();
		main.start(AbstractFactoryClientForComprehensiveExperiment.primaryStage);
	}
}
